﻿@model CmsAdminTemplateModel

@{
    ResFile = "cms_Templates";
}

<fieldset class="b-form">
@using (Html.BeginForm(Model.IsNew ? "add" : "edit", "cmstemplate"))
{
    @Html.HiddenFor(m=>m.TemplateTypeKey)
    <ol class="b-form__rows ul-reset g-clear">
        <li class="b-form__row g-clear">
            <label for="TemplateName">@_("Name")</label>
            @Html.TextBoxFor(p => p.TemplateName, new { @class = "text" })
            @Html.ValidationMessageFor(p => p.TemplateName)
        </li>
        <li class="b-form__row g-clear">
            <label for="TemplateUrl">@_("Template url")</label>
            @Html.TextBoxFor(p => p.TemplateUrl, new { @class = "text rel-property" })
            @{Html.RenderPartial("FileViewDialog", new CmsFileViewModel{ DialogFor = "Template", TargetId = "TemplateUrl" });}
            @Html.ValidationMessageFor(p => p.TemplateUrl)
        </li>
        @*<li class="b-form__row g-clear">
            <label for="language">Template type</label>
            @Html.DropDownList("TemplateTypeKey", new SelectList(Model.TemplateTypeList, "Value", "Text", Model.TemplateTypeKey), new { id = "TemplateTypeList" })        
        </li>*@
        <li class="b-form__row g-clear">
            <label for="IsDefault">@_("Default template")</label>
            @Html.CheckBoxFor(p => p.IsDefault)
        </li>

        @if (!Model.IsNew)
        { 
        <li class="b-form__row g-clear">
            <label for="DefaultRegionId">@_("Default Region")</label>
            @Html.DropDownListFor(p => p.DefaultRegionId, Model.Regions, _("Please select"))
        </li>
        }

        @(Html.UserGroupPlaceholder().ForUserGroups(PredefinedUserGroups.Developer).Template(
                @<text>
                    <li class="b-form__row g-clear">
                        <label>@_("Template scope")</label>
                        @Html.Partial("SiteAwarePlug", Model)
                    </li>
                </text>)
                .AlternativeTemplate(
                @<text>
                    <li class="b-form__row g-clear" style="display:none">
                        <label>@_("Template scope")</label>
                        @Html.Partial("SiteAwarePlug", Model)
                    </li>
                </text>)
                .Render())
        @if (!Model.IsNew)
        { 
        <li class="b-form__row g-clear">
            @Html.HiddenFor(p => p.Id)
        </li>
        }
        <li class="b-form__row b-form__row_buttons g-clear">
        	<input class="b-button" id="btnSave" name="btnSave" type="submit" value="@_("Save")" />
        </li>
    </ol>
}	
</fieldset>